package com.xrc.T3;

public class Cat  implements Comparable<Cat> {
    private Integer age;
    private String name;
    private String color;

    public Cat() {

    }

    public Cat(String name, String color) {
        this.name = name;
        this.color = color;
    }

    public Cat(Integer age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public void setAge(Integer age) {
        this.age = age;
    }


    @Override
    public String toString() {
        return "Cat{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", color='" + color + '\'' +
                '}';
    }

    @Override
    //用返回值的大于等于小于0来比较大小
    public int compareTo(Cat cat) {
        return this.age - cat.age;
    }

}